* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* 移除iOS点击高亮 */
}

html, body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    width: 100%;
    height: 100%;
    overflow: hidden;
    color: #333;
}

.container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 20px;
    text-align: center;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

h1 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.8em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.game-info {
    margin-bottom: 15px;
}

#status {
    font-size: 1.3em;
    margin-bottom: 15px;
    font-weight: bold;
    color: #34495e;
    min-height: 2em;
}

#restartBtn {
    background: #3498db;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 30px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    touch-action: manipulation;
    min-height: 50px;
    min-width: 150px;
}

#restartBtn:active {
    background: #2980b9;
    transform: scale(0.95);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

.game-board {
    background: #deb887;
    border: 8px solid #8b4513;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    margin: 0 auto 15px;
    position: relative;
    flex: 1;
    max-width: 100%;
    max-height: 70vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

canvas {
    display: block;
    touch-action: none; /* 防止移动设备上的默认触摸行为 */
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

.game-rules {
    text-align: left;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #3498db;
    font-size: 1em;
    overflow-y: auto;
    max-height: 15vh;
}

h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.2em;
}

ul {
    list-style-position: inside;
    line-height: 1.8;
}

li {
    margin-bottom: 8px;
    font-size: 0.95em;
}

/* 移动端优化 */
@media (max-width: 600px) {
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 1.6em;
        margin-bottom: 10px;
    }
    
    #status {
        font-size: 1.2em;
        margin-bottom: 12px;
    }
    
    #restartBtn {
        padding: 12px 25px;
        font-size: 1.1em;
        min-height: 45px;
    }
    
    .game-board {
        border: 5px solid #8b4513;
        margin-bottom: 10px;
    }
    
    .game-rules {
        padding: 10px;
        max-height: 12vh;
    }
    
    h3 {
        font-size: 1.1em;
        margin-bottom: 8px;
    }
    
    li {
        font-size: 0.9em;
        margin-bottom: 5px;
    }
}

/* 横屏模式优化 */
@media screen and (orientation: landscape) {
    .container {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
    }
    
    h1 {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .game-info {
        width: 100%;
        margin-bottom: 10px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .game-board {
        flex: 0 0 auto;
        max-height: calc(100vh - 100px);
        margin: 0 10px 0 0;
    }
    
    .game-rules {
        flex: 1;
        min-width: 200px;
        max-height: calc(100vh - 100px);
    }
}